#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@file: gk_html_md.py
@author: lyndon
@time: Created on 2022-02-26 21:00
@env: Python
@desc:
@ref:
@blog:
"""

import os
import json
import html2text
import requests
# import urllib3


def load(jsonfile):
    with open(jsonfile, mode='r', encoding='utf-8') as f:
        data = json.load(f)
        return data


if __name__ == '__main__':

    r = requests.get("http://c.biancheng.net/view/2188.html")
    r.headers['Cookie'] = 'Hm_lvt_ef8113430e2dcae44abc0e42dc639917=1656305082; ppoints=0; pvip=10; userinfo=%7B%22username%22%3A%22173734%22%2C%22password%22%3A%2206d2s8DwWSoHM2VuRAdIDoxVtMFkXsQNUgpgwwJL3LUVjf8fbJp6TyBGLxkLfLcuLkyMTRC1Nx72%22%2C%22usertype%22%3A2%7D; __51cke__=; __tins__21368967=%7B%22sid%22%3A%201676371169988%2C%20%22vd%22%3A%204%2C%20%22expires%22%3A%201676373063864%7D; __51laig__=10'
    print(r.text)

    # http = urllib3.PoolManager()
    # r = http.request("GET", "http://c.biancheng.net/view/2188.html")
    # print(r.data)

    outfile = r"D:\iProject\myPython\com\teradata\seleniumtest\biancheng\out\qm.md"
    with open(outfile, mode='a+', encoding='utf-8') as fo:
        fo.write(html2text.html2text(r.text))
